package com.molyfun.parents.rest.bean;

import android.os.Parcel;
import android.os.Parcelable;

import com.molyfun.parents.activity.course.bean.CourseMediaBean;
import com.molyfun.parents.rest.BaseResponse;

import java.util.List;

/**
 * Created by william(liuchao.hit@gmail.com).
 * Date:10/31/16.
 */
public class CourseListResponse extends BaseResponse {

    private CourseBeanList data;

    public CourseBeanList getData(){
        return data;
    }

    public static class CourseBeanList implements Parcelable {

        private int offset;
        private int limit;
        private int total;
        private int size;
        private int pages;
        private int current;
        private boolean searchCount;
        private List<CourseBean> records;
//        private Object orderByField;
        private boolean asc;
        private int offsetCurrent;

        public int getOffset() {
            return offset;
        }

        public void setOffset(int offset) {
            this.offset = offset;
        }

        public int getLimit() {
            return limit;
        }

        public void setLimit(int limit) {
            this.limit = limit;
        }

        public int getTotal() {
            return total;
        }

        public void setTotal(int total) {
            this.total = total;
        }

        public int getSize() {
            return size;
        }

        public void setSize(int size) {
            this.size = size;
        }

        public int getPages() {
            return pages;
        }

        public void setPages(int pages) {
            this.pages = pages;
        }

        public int getCurrent() {
            return current;
        }

        public void setCurrent(int current) {
            this.current = current;
        }

        public boolean isSearchCount() {
            return searchCount;
        }

        public void setSearchCount(boolean searchCount) {
            this.searchCount = searchCount;
        }

        public List<CourseBean> getRecords() {
            return records;
        }

        public void setRecords(List<CourseBean> records) {
            this.records = records;
        }

        public boolean isAsc() {
            return asc;
        }

        public void setAsc(boolean asc) {
            this.asc = asc;
        }

        public int getOffsetCurrent() {
            return offsetCurrent;
        }

        public void setOffsetCurrent(int offsetCurrent) {
            this.offsetCurrent = offsetCurrent;
        }

        public CourseBeanList() {
        }

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeInt(this.offset);
            dest.writeInt(this.limit);
            dest.writeInt(this.total);
            dest.writeInt(this.size);
            dest.writeInt(this.pages);
            dest.writeInt(this.current);
            dest.writeByte(this.searchCount ? (byte) 1 : (byte) 0);
            dest.writeTypedList(this.records);
            dest.writeByte(this.asc ? (byte) 1 : (byte) 0);
            dest.writeInt(this.offsetCurrent);
        }

        protected CourseBeanList(Parcel in) {
            this.offset = in.readInt();
            this.limit = in.readInt();
            this.total = in.readInt();
            this.size = in.readInt();
            this.pages = in.readInt();
            this.current = in.readInt();
            this.searchCount = in.readByte() != 0;
            this.records = in.createTypedArrayList(CourseBean.CREATOR);
            this.asc = in.readByte() != 0;
            this.offsetCurrent = in.readInt();
        }

        public static final Creator<CourseBeanList> CREATOR = new Creator<CourseBeanList>() {
            @Override
            public CourseBeanList createFromParcel(Parcel source) {
                return new CourseBeanList(source);
            }

            @Override
            public CourseBeanList[] newArray(int size) {
                return new CourseBeanList[size];
            }
        };
    }


    public static class CourseBean implements Parcelable {

        /**
         * id : 402883ad57d65bc80157d65d8eeb0000
         * courseplanid : 4028836857a838150157a89381bb002e
         * coursename : MPV to out诺诺偷偷某某图谋
         * coursetarget :
         * courseprocess :
         * result : 2
         * resultname : +
         * feedbackstatus : 0
         * courseperformance :
         * typestyle : 1
         * courseid : 8a2d926357410d3901574c10e9540829
         * relid : c02f641ee8ff4b03aed2ac457a9a2092
         * mediaobjectlist : [{"url":"http://oa91iwip0.bkt.clouddn.com/helloimg/gallery/20160720102037aMkgOJbd.jpg?imageMogr2/thumbnail/300x300","type":"1","bigurl":"http://oa91iwip0.bkt.clouddn.com/helloimg/gallery/20160720102037aMkgOJbd.jpg?imageMogr2/thumbnail/1280x1280","smallurl":"http://oa91iwip0.bkt.clouddn.com/helloimg/gallery/20160720102037aMkgOJbd.jpg?imageMogr2/thumbnail/100x100","courseid":"8a2d926357410d3901574c10e9540829","galleryname":"找相同卡-热狗","isgame":null,"imgurl":null,"gameid":null,"offlineurl":null}]
         */

        /**
         * 课程记录ID
         */
        private String id;
        private String courseplanid;
        private String coursename;
        private String coursetarget;
        private String courseprocess;
        private String result;
        private String resultname;
        private String feedbackstatus;
        private String courseperformance;
        private String typestyle;
        /**
         * 课程ID
         */
        private String courseid;
        /**
         * 搜藏ID 下载id 有值表示已经下载，空表示没有下载
         */
        private String relid;
        private boolean isChecked = false;//local value, to record whether the course is bean choosed
        /**
         * url : http://oa91iwip0.bkt.clouddn.com/helloimg/gallery/20160720102037aMkgOJbd.jpg?imageMogr2/thumbnail/300x300
         * type : 1
         * bigurl : http://oa91iwip0.bkt.clouddn.com/helloimg/gallery/20160720102037aMkgOJbd.jpg?imageMogr2/thumbnail/1280x1280
         * smallurl : http://oa91iwip0.bkt.clouddn.com/helloimg/gallery/20160720102037aMkgOJbd.jpg?imageMogr2/thumbnail/100x100
         * courseid : 8a2d926357410d3901574c10e9540829
         * galleryname : 找相同卡-热狗
         * isgame : null
         * imgurl : null
         * gameid : null
         * offlineurl : null
         * isupdate : null
         */

        private int feedbacktimes;

        private String dkey;

        private List<CourseMediaBean> mediaobjectlist;
        private List<CourseMediaBean> planmediaobjectlist;

        private String isupdate;
        private String size;

        private String username;
        private String headimgurl;
        private String groupname;//学生所在的班级的组或班级名称


        public String getSize() {
            return size;
        }

        public void setSize(String size) {
            this.size = size;
        }

        public String getId() {
            return id;
        }

        public void setId(String id) {
            this.id = id;
        }

        public String getCourseplanid() {
            return courseplanid;
        }

        public void setCourseplanid(String courseplanid) {
            this.courseplanid = courseplanid;
        }

        public String getCoursename() {
            return coursename;
        }

        public void setCoursename(String coursename) {
            this.coursename = coursename;
        }

        public String getCoursetarget() {
            return coursetarget;
        }

        public void setCoursetarget(String coursetarget) {
            this.coursetarget = coursetarget;
        }

        public String getCourseprocess() {
            return courseprocess;
        }

        public void setCourseprocess(String courseprocess) {
            this.courseprocess = courseprocess;
        }

        public String getResult() {
            return result;
        }

        public void setResult(String result) {
            this.result = result;
        }

        public String getResultname() {
            return resultname;
        }

        public void setResultname(String resultname) {
            this.resultname = resultname;
        }

        public String getFeedbackstatus() {
            return feedbackstatus;
        }

        public void setFeedbackstatus(String feedbackstatus) {
            this.feedbackstatus = feedbackstatus;
        }

        public String getCourseperformance() {
            return courseperformance;
        }

        public void setCourseperformance(String courseperformance) {
            this.courseperformance = courseperformance;
        }

        public String getTypestyle() {
            return typestyle;
        }

        public void setTypestyle(String typestyle) {
            this.typestyle = typestyle;
        }

        public String getCourseid() {
            return courseid;
        }

        public void setCourseid(String courseid) {
            this.courseid = courseid;
        }

        public String getRelid() {
            return relid;
        }

        public void setRelid(String relid) {
            this.relid = relid;
        }

        //主要是用来展示cover用
        public List<CourseMediaBean> getMediaobjectlist() {
//            if(mediaobjectlist != null && mediaobjectlist.size() > 0){
                return mediaobjectlist;
//            }
//            return planmediaobjectlist;
        }

        public void setMediaobjectlist(List<CourseMediaBean> mediaobjectlist) {
            this.mediaobjectlist = mediaobjectlist;
        }


        public List<CourseMediaBean> getPlanmediaobjectlist() {
            return planmediaobjectlist;
        }

        public void setPlanmediaobjectlist(List<CourseMediaBean> planmediaobjectlist) {
            this.planmediaobjectlist = planmediaobjectlist;
        }

        public boolean isChecked() {
            return isChecked;
        }

        public void setIsChecked(boolean isChecked) {
            this.isChecked = isChecked;
        }

        public String getIsupdate() {
            return isupdate;
        }

        public void setIsupdate(String isupdate) {
            this.isupdate = isupdate;
        }

        public int getFeedbacktimes() {
            return feedbacktimes;
        }

        public void setFeedbacktimes(int feedbacktimes) {
            this.feedbacktimes = feedbacktimes;
        }

        public String getDkey() {
            return dkey;
        }

        public void setDkey(String dkey) {
            this.dkey = dkey;
        }

        public CourseBean() {
        }


        public String getUsername() {
            return username;
        }

        public void setUsername(String username) {
            this.username = username;
        }


        public String getHeadimgurl() {
            return headimgurl;
        }

        public void setHeadimgurl(String headimgurl) {
            this.headimgurl = headimgurl;
        }

        public String getGroupname() {
            return groupname;
        }

        public void setGroupname(String groupname) {
            this.groupname = groupname;
        }

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeString(this.id);
            dest.writeString(this.courseplanid);
            dest.writeString(this.coursename);
            dest.writeString(this.coursetarget);
            dest.writeString(this.courseprocess);
            dest.writeString(this.result);
            dest.writeString(this.resultname);
            dest.writeString(this.feedbackstatus);
            dest.writeString(this.courseperformance);
            dest.writeString(this.typestyle);
            dest.writeString(this.courseid);
            dest.writeString(this.relid);
            dest.writeByte(this.isChecked ? (byte) 1 : (byte) 0);
            dest.writeInt(this.feedbacktimes);
            dest.writeString(this.dkey);
            dest.writeTypedList(this.mediaobjectlist);
            dest.writeTypedList(this.planmediaobjectlist);
            dest.writeString(this.isupdate);
            dest.writeString(this.size);
            dest.writeString(this.username);
            dest.writeString(this.headimgurl);
            dest.writeString(this.groupname);
        }

        protected CourseBean(Parcel in) {
            this.id = in.readString();
            this.courseplanid = in.readString();
            this.coursename = in.readString();
            this.coursetarget = in.readString();
            this.courseprocess = in.readString();
            this.result = in.readString();
            this.resultname = in.readString();
            this.feedbackstatus = in.readString();
            this.courseperformance = in.readString();
            this.typestyle = in.readString();
            this.courseid = in.readString();
            this.relid = in.readString();
            this.isChecked = in.readByte() != 0;
            this.feedbacktimes = in.readInt();
            this.dkey = in.readString();
            this.mediaobjectlist = in.createTypedArrayList(CourseMediaBean.CREATOR);
            this.planmediaobjectlist = in.createTypedArrayList(CourseMediaBean.CREATOR);
            this.isupdate = in.readString();
            this.size = in.readString();
            this.username = in.readString();
            this.headimgurl = in.readString();
            this.groupname = in.readString();
        }

        public static final Creator<CourseBean> CREATOR = new Creator<CourseBean>() {
            @Override
            public CourseBean createFromParcel(Parcel source) {
                return new CourseBean(source);
            }

            @Override
            public CourseBean[] newArray(int size) {
                return new CourseBean[size];
            }
        };
    }


}
